<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="h" uri="/hd-tags"%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>机型资料</title>
<script type="text/javascript" src="js/jquery-1.2.6.js"></script>

<link href="style/main.css" rel="stylesheet" type="text/css"/>
<link href="style/glowtabs.css" rel="stylesheet" type="text/css" />
</head>

<body class="body_content">
<div id="wrap">
	<div id="main" class="clearfix">

<jsp:include page="../header.jsp"></jsp:include>

<div class="ricoh_content_k">
	<div class="ricoh_title">--- 机型资料 --- </div>
	<div class="ricoh_content_in">
	
	  <form action="machine_saveNewMachine.action" method="post" onsubmit="return validation();">
   		<div class="find_k">
   		
   		  <div class="inform_guest_k" style="width:790px;">
       	    <div class="inform_guest" style="width:80%">
       	      <label>品牌：</label>
                	<select name="machine.brand" id="select">
                	    <option value="0">-品牌品牌-</option>
           	        </select>
   	        </div>
          </div>
          
          
   		  <div class="inform_guest_k" style="width:790px;">
            <div class="inform_guest" style="width:80%">
                 <label>机型：</label>
                      <input type="text" name="machine.machineModel" id="machineModel" maxlength="50"/>
            </div>
          </div>
          
          
          <div class="inform_guest_k" style="width:790px;">
           	<div class="inform_guest" style="width:80%">
                <label>设计寿命：</label>
                	<div style="float:left"><input type="text" name="machine.yearsOfLife" id="yearsOfLife" maxlength="50" size="5"/>年&nbsp;&nbsp;&nbsp;</div>
             		
                	<div><input type="text" name="sheetyOfLife" id="sheetyOfLife" maxlength="50"/>张</div>
       	    </div>
          </div>
          
          
          <div class="inform_guest_k" style="width:790px; border:none; height:60px;">
           	<div class="inform_guest" style="width:98%">
           	  <div class="fl"><label>机器类别：</label></div><div class="fl">            	
                <div style="height:30px;">
                
	                <input type="radio" name="machine.category" class="category" id="radio" value="0" style="border:none" onclick="checkMaterial('dfgm');"/>
	           	         <label style="width:8em; text-align:left">A4数码多功能机</label>
	                	
	                <input type="radio" name="machine.category" class="category" id="radio" value="4" style="border:none" onclick="checkMaterial('ys');"/>
	           	  		<label style="width:6em; text-align:left">数码印刷机</label>
	           	  		
	                <input type="radio" name="machine.category" class="category" id="radio" value="6" style="border:none" onclick="checkMaterial('cd');"/>
	           	  		<label style="width:6em; text-align:left">彩色复印机</label>
	           	  		
	           	  	<input type="radio" name="machine.category" class="category" id="radio" value="5" style="border:none" onclick="checkMaterial('cz');"/>
              			<label style="width:6em; text-align:left">传真机</label>
           	  	</div>
           	  	
           	  	<div>
           	  		<input type="radio" name="machine.category" class="category" id="radio" value="1" style="border:none" onclick="checkMaterial('dfgm');"/>
	                	<label style="width:8em; text-align:left">A3数码复合机</label> 
           	  	
           	  		<input type="radio" name="machine.category" class="category" id="radio" value="2" style="border:none" onclick="checkMaterial('dfgm');"/>
	           	  		<label style="width:6em; text-align:left">数码工程机</label>
                			
	                <input type="radio" name="machine.category" class="category" id="radio" value="7" style="border:none" onclick="checkMaterial('cd');"/>
	           	  		<label style="width:6em; text-align:left">打印机</label>
              			
              		<input type="radio" name="machine.category" class="category" id="radio" value="3" style="border:none" onclick="checkMaterial('dfgm');"/>
           	  			<label style="width:6em; text-align:left">模拟复印机</label>
           	 	</div>
           	 	
           	  </div><div class="clear"></div></div>
          </div>
        </div>
        
        
        <div class="find_k materialForm" style="margin-top:15px;display:none" id="dfgm">
	        <p style="color:#999999; padding-bottom:8px;">--多功机能/复合机/工程机/模拟机耗材信息--</p>
		        <div class="inform_guest_k" style="width:790px;">
		        
		       	    <div class="inform_guest" style="width:44%">
		       	      <label style="width:90px;">鼓/鼓组件型号：</label>
		                	 <input type="text" name="machine.cartridgeModel" id="cartridgeModel"  class="material" maxlength="50"/>
		   	        </div>
		   	        
		            <div class="inform_guest" style="width:44%">
		       	      <label>使用张数：</label>
		                	  <input type="text" name="cartridgeSheety" id="cartridgeSheety"  class="material" maxlength="10"/>
		   	        </div>
		        </div>
		        
		        
		        <div class="inform_guest_k" style="width:790px;">
		       	    <div class="inform_guest" style="width:44%">
		       	      <label style="width:90px;">碳粉型号：</label>
		                	 <input type="text" name="machine.carbonPowderModel" id="carbonPowderModel"  class="material" maxlength="50"/>
		   	        </div>
		   	        
		            <div class="inform_guest" style="width:44%">
		       	      <label>使用张数：</label>
		                	  <input type="text" name="carbonPowderSheety" id="carbonPowderSheety"  class="material" maxlength="10"/>
		   	        </div>
		   	        
		          </div>
		          
		        <div class="inform_guest_k" style="width:790px;">
		        
		       	    <div class="inform_guest" style="width:44%">
		       	      <label style="width:90px;">载体型号：</label>
		                	 <input type="text" name="machine.carrierModel" id="carrierModel"  class="material" maxlength="50"/>
		   	        </div>
		   	        
		            <div class="inform_guest" style="width:44%">
		       	      <label>使用张数：</label>
		                	  <input type="text" name="carrierSheety" id="carrierSheety"  class="material" maxlength="10"/>
		   	        </div>
		        </div>
	    </div>
        
        <div class="find_k materialForm" style="margin-top:15px;display:none" id="ys">
	        <p style="color:#999999; padding-bottom:8px;">--印刷机耗材信息--</p>
		        <div class="inform_guest_k" style="width:790px;">
		        
		       	    <div class="inform_guest" style="width:44%">
		       	      <label>油墨型号：</label>
		                	 <input type="text" name="machine.printingInkModel" id="printingInkModel"  class="material" maxlength="50"/>
		   	        </div>
		   	        
		            <div class="inform_guest" style="width:44%">
		       	      <label>使用张数：</label>
		                	  <input type="text" name="printingInkSheety" id="printingInkSheety"  class="material" maxlength="10"/>
		   	        </div>
		   	        
		        </div>
		        
		        <div class="inform_guest_k" style="width:790px;">
		        
		       	    <div class="inform_guest" style="width:44%">
		       	      <label>版纸型号：</label>
		                	 <input type="text" name="machine.paperboardModel" id="paperboardModel"  class="material" maxlength="50"/>
		   	        </div>
		   	        
		            <div class="inform_guest" style="width:44%">
		       	      <label>使用张数：</label>
		                	  <input type="text" name="paperboardSheety" id="paperboardSheety"  class="material" maxlength="10"/>
		   	        </div>
		   	        
		        </div>
        </div>
        
        <div class="find_k materialForm" style="margin-top:15px;display:none" id="cz">
	       		<p style="color:#999999; padding-bottom:8px;">--传真机耗材信息--</p>
		        <div class="inform_guest_k" style="width:790px;">
		        
		       	    <div class="inform_guest" style="width:44%">
		       	      <label style="width:90px;">鼓/鼓组件型号：</label>
		                	 <input type="text" name="machine.cartridgeModel" id="cartridgeModel"  class="material" maxlength="50"/>
		   	        </div>
		   	        
		            <div class="inform_guest" style="width:44%">
		       	      <label>使用张数：</label>
		                	  <input type="text" name="cartridgeSheety" id="cartridgeSheety"  class="material" maxlength="10"/>
		   	        </div>
		        </div>
	    </div>
	        
	        
        <div class="find_k materialForm" style="margin-top:15px;display:none" id="cd">
	        <p style="color:#999999; padding-bottom:8px;">--彩色复印机/打印机主耗材信息--</p>
	        <div class="inform_guest_k" style="width:790px;">
	        
	       	    <div class="inform_guest" style="width:44%">
	       	      <label>鼓型号：</label>
	                <input type="text" name="machine.cartridgeModel" id="cartridgeModel"  class="material" maxlength="50"/>
	   	        </div>
	   	        
	            <div class="inform_guest" style="width:44%">
	       	      <label>使用张数：</label>
	                <input type="text" name="cartridgeSheety" id="cartridgeSheety"  class="material" maxlength="10"/>
	   	        </div>
	   	        
	          </div>
	          <div class="inform_guest_k" style="width:790px;">
	          
	       	    <div class="inform_guest" style="width:44%">
	       	      <label>黑粉型号：</label>
	                	 <input type="text" name="machine.blackPowderModel" id="blackPowderModel"  class="material" maxlength="50"/>
	   	        </div>
	   	        
	            <div class="inform_guest" style="width:44%">
	       	      <label>使用张数：</label>
	                	  <input type="text" name="blackPowderSheety" id="blackPowderSheety"  class="material" maxlength="10"/>
	   	        </div>
	          </div>
	          
	          
	          <div class="inform_guest_k" style="width:790px;">
	          
	       	    <div class="inform_guest" style="width:44%">
	       	      <label>彩色粉型号：</label>
	                	 <input type="text" name="machine.colorPowderModel" id="colorPowderModel"  class="material" maxlength="50"/>
	   	        </div>
	   	        
	            <div class="inform_guest" style="width:44%">
	       	      <label>使用张数：</label>
	                	  <input type="text" name="colorPowderSheety" id="colorPowderSheety"  class="material" maxlength="10"/>
	   	        </div>
	   	        
	          </div>
	          
	          <div class="inform_guest_k" style="width:790px;">
	       	    <div class="inform_guest" style="width:44%">
	       	      <label>载体型号：</label>
	                	 <input type="text" name="machine.carrierModel" id="carrierModel"  class="material" maxlength="50"/>
	   	        </div>
	            <div class="inform_guest" style="width:44%">
	       	      <label>使用张数：</label>
	                	  <input type="text" name="carrierSheety" id="carrierSheety"  class="material" maxlength="10"/>
	   	        </div>
	         </div>
        </div>
        
        
        <p style="padding-top:8px; margin-left:200px;">
          <input type="submit" value="保存"  class="send_btn"/>
        </p>
        
      </form>
        
  </div>
</div>

</div>
</div>

<jsp:include page="../footer.jsp"></jsp:include>

</body>
<script type="text/javascript" src="js/ddtabmenu.js"></script>
<script type="text/javascript">
	ddtabmenu.definemenu("ddtabs2", 3);

	$(document).ready(function(){
		if(${statusTemp} == true){
			alert("添加成功");
		}
	});

	function checkMaterial(category){
		$(".material").val("");
		$(".materialForm").css("display","none");
		$("#"+category).css("display","block");
	}

	function validation(){
		if($("#machineModel").val() == ""){
			alert("请输入机型");
			return false;
		}else if($("#yearsOfLife").val() == ""){
			alert("请输入机器寿命（年份）");
			return false;
		}else if($("#sheetyOfLife").val() == ""){
			alert("请输入机器寿命（张数）");
			return false;
		}else if(validationRadio() == false){
			alert("请选择机器类别");
			return false;
		}else if(validationText() == false){
			alert("请将耗材信息填写完整");
			return false;
		}else{
			return true;
		};
	}

	function validationText(){
		var flag = true;
		$(".materialForm:visible input").each(function(){
			if($(this).val() == ""){
				flag = false;
			}
		});

		return flag;
	}

	function validationRadio(){
		var flag = false;
		$(".category").each(function(){
			if($(this).attr("checked") == true){
				flag = true;
			};
		});
		return flag;
	}
</script>
</html>
